package com.itheima.search.controller;


import com.itheima.search.searchService.SearchService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.*;

import java.util.Map;

@RestController
@CrossOrigin("*") // 处理跨域问题
@Controller
@RequestMapping("/search")
public class SearchController {
    @Autowired
    private SearchService searchService;

    @PostMapping
    public Map search(@RequestBody Map searchMap) throws Exception {
        Map resultMap = searchService.search(searchMap);
        return resultMap;
    }
}
